package com.asiainfo.dacp.datastash.broker.listener;

import com.asiainfo.dacp.core.BeanFactory;
import com.asiainfo.dacp.datastash.broker.tracelog.StashTraceLogVo;
import com.asiainfo.dacp.datastash.broker.tracelog.StashTraceLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 监听器启动
 *
 * @author MeiKefu
 * @date 2017-11-23
 */
public class BrokerListenerManager {

    private static Logger LOG = LoggerFactory.getLogger(BrokerListenerManager.class);
    private String clzName = this.getClass().getSimpleName();

    public void startup() {

        StashTraceLogger Logger = BeanFactory.getBean(StashTraceLogger.class);


        LOG.info("unit - 依赖队列");
        new Thread(new UnitWaitQueueListener()).start();
        Logger.info(new StashTraceLogVo(clzName,"brokerLis:waitQueue:startup","启动unit依赖队列监听"));

        LOG.info("unit - task 依赖队列");
        new Thread(new UnitTaskWaitQueueListener()).start();
        Logger.info(new StashTraceLogVo(clzName,"brokerLis:taskWaitQueue:startup","启动unit分片队列监听"));
        
        LOG.info("启动broker monitor性能指标监听");
        new Thread(new BrokerMonitorQueueListener()).start();
        Logger.info(new StashTraceLogVo(clzName,"brokerLis:monitorQueue:startup","启动broker monitor性能指标监听"));

        LOG.info("启动任务分配监听队列");
        new Thread(new UnitTaskDispatchQueueListener()).start();
        Logger.info(new StashTraceLogVo(clzName,"brokerLis:taskDispQueue:startup","启动任务分配监听队列"));

        LOG.info("启动broker work执行队列监听");
        new Thread(new UnitWorkQueueListener()).start();
        Logger.info(new StashTraceLogVo(clzName,"brokerLis:workQueue:startup","启动broker work执行队列监听"));

        new Thread(new BrokerTraceLogListener()).start();
        Logger.info(new StashTraceLogVo(clzName,"brokerLis:tracelog:startup","启动轨迹日志队列监听"));

    }

}
